
function displayloading(){
    var $this = $( this ),
    theme = $this.jqmData( "theme" ) || $.mobile.loader.prototype.options.theme,
    msgText = $this.jqmData( "msgtext" ) || $.mobile.loader.prototype.options.text,
    textVisible = $this.jqmData( "textvisible" ) || $.mobile.loader.prototype.options.textVisible,
    textonly = !!$this.jqmData( "textonly" );
    html = $this.jqmData( "html" ) || "";
    
    $.mobile.loading( 'show', {
                     text: "loading ...",
                     textVisible: "true",
                     theme: theme,
                     textonly: textonly,
                     html: html
                     });
    console.log(".............loading");
}

function undisplayloading(){
    $.mobile.hidePageLoadingMsg();
}
function tableMaker(map,pageLocation,id,bool){
    console.log("uicontroller.js >>tablemaker");
    var tableSize;
    var basicTable="";
    var tdNumber=1;
    var imgN=1;
    
    console.log("uicontroller.js >>tablemaker map size " + map.size());
    
    tableSize = map.size()/16;
    
    console.log("uicontroller.js >>tablemaker tableSize " + tableSize);
    
    if(tableSize<2)
        tableSize=2;
    lastTableSize = map.size()%16;
    if(id == "t1"){
    for(j=0; j <tableSize + 1;j++){
        
        basicTable +="<table width='100%'>";
        
        for(i=0;i<16;i++)
        {
            
            console.log("uicontroller.js >>tablemaker j " + j);
            console.log("uicontroller.js >>tablemaker i " + i);
            if(agentListIdxMap.get(imgN-1) != "" || agentListIdxMap.get(imgN-1) != null){
            basicTable += "<tr>";
            basicTable += "<td align='center' height='100'><a href=javascript:agentDoIt("+agentListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png'  width='70px' height='70px'></a></td>";
            imgN++;
            }
            if(agentListIdxMap.get(imgN-1) != "" || agentListIdxMap.get(imgN-1) != null){
            basicTable += "<td align='center'><a href=javascript:agentDoIt("+agentListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
            imgN++;
            }
            if(agentListIdxMap.get(imgN-1) != "" || agentListIdxMap.get(imgN-1) != null){
            basicTable += "<td align='center'><a href=javascript:agentDoIt("+agentListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
            imgN++;
            }
            if(agentListIdxMap.get(imgN-1) != "" || agentListIdxMap.get(imgN-1) != null){
            basicTable += "<td align='center'><a href=javascript:agentDoIt("+agentListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td></tr>";
            imgN++;            
            }
            console.log("uicontroller.js >>tablemaker imgN " + imgN);
            
            basicTable += trHtmlS+"<td align='center' width='25%' id = 'tdN"+tdNumber;
            tdNumber++;
            basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
            tdNumber++;
            basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
            tdNumber++;
            basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber+"'></td>"+trHtmlE;
            tdNumber++;            
            basicTable += "<tr><td height='20'></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr>";
            
            
            console.log("uicontroller.js >>tablemaker tdNumber " + tdNumber);
        }       
        
        basicTable += "</table>";
        
    }
    }else if(id=="t2"){
        for(j=0; j <tableSize;j++){
            
            basicTable +="<table width='100%'>";
            
            for(i=0;i<16;i++)
            {
                basicTable += "<tr>";
                basicTable += "<td align='center' height='100'><a href=javascript:agentDoIt("+contractListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png'  width='70px' height='70px'></a></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+contractListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+contractListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+contractListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td></tr>";
                imgN++;
                basicTable += trHtmlS+"<td align='center' width='25%' id = 'tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber+"'></td>"+trHtmlE;
                tdNumber++;
                basicTable += "<tr><td height='20'></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr>";
            }       
            
            basicTable += "</table>";
            
        }

    }else{
        for(j=0; j <tableSize;j++){
            
            basicTable +="<table width='100%'>";
            
            for(i=0;i<16;i++)
            {
                basicTable += "<tr>";
                basicTable += "<td align='center' height='100'><a href=javascript:agentDoIt("+recommendListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png'  width='70px' height='70px'></a></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+recommendListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+recommendListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td>";
                imgN++;
                basicTable += "<td align='center'><a href=javascript:agentDoIt("+recommendListIdxMap.get(imgN-1)+",'"+sessionStorage.getItem('id')+"','"+bool+"')><img id='imgN"+imgN+"'src='img/blank.png' width='70px' height='70px'></td></tr>";
                imgN++;
                basicTable += trHtmlS+"<td align='center' width='25%' id = 'tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber;
                tdNumber++;
                basicTable +="'></td><td align='center' width='25%' id ='tdN"+tdNumber+"'></td>"+trHtmlE;
                tdNumber++;
                basicTable += "<tr><td height='20'></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr>";
            }       
            
            basicTable += "</table>";
            
        }

    }
  if( map.size() > 0)
        $('#'+pageLocation).html(basicTable);
   else
        $('#'+pageLocation).html("");
    
    
}

